package com.itheima.config.postProcessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @program: Spring_day01_01_IOC入门程序
 * @description: BeanPostProcessor定义了所有Bean初始化前后进行的统一动作，用于对bean进行创建前业务处理与创建后业务处理。
 * 所以bean的前后都要有接口
 * @author: xuejingjing
 * @create: 2021-08-02 15:11
 **/

//现在写完，spring是找不到这个东西的，就需要在@Import加上XXX
public class MyBean  implements BeanPostProcessor {

    public  Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println(beanName);
        System.out.println("bean之前xxxxx");
        return bean;
    }


    public  Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("bean之后xxxxx");
        return bean;
    }
}
